﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CreatePassword
{
    public partial class Form1 : Form
    {
        public static string Digit = "0123456789";
        public static string Lowercase = "abcdefghijklmnopqrstuvwxyz";
        public static string Uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        public static string Symbol = "~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./";

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Password.Text = string.Empty;
            Random r = new Random();

            for (int x = 0; x < 10; x++)
            {
                string temp = string.Empty;
                int count = 0;
                count = (int)this.DigitCount.Value;
                for (int i = 0; i < count; i++)
                {
                    temp += Digit[r.Next(0, Digit.Length - 1)];
                }
                count = (int)this.LowercaseCount.Value;
                for (int i = 0; i < count; i++)
                {
                    temp += Lowercase[r.Next(0, Lowercase.Length - 1)];
                }
                count = (int)this.UppercaseCount.Value;
                for (int i = 0; i < count; i++)
                {
                    temp += Uppercase[r.Next(0, Uppercase.Length - 1)];
                }
                count = (int)this.SymbolCount.Value;
                for (int i = 0; i < count; i++)
                {
                    temp += Symbol[r.Next(0, Symbol.Length - 1)];
                }

                List<char> cs = new List<char>();
                for (int i = 0; i < temp.Length; i++)
                {
                    cs.Add(temp[i]);
                }

                while (cs.Count > 0)
                {
                    int address = r.Next(0, cs.Count - 1);
                    this.Password.Text += cs[address];
                    cs.RemoveAt(address);
                }

                this.Password.Text += Environment.NewLine;
            }
        }
    }
}
